package com.sxfq.loansupermarket.backsystem.modular.theTest.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.sxfq.loansupermarket.backsystem.core.shiro.ShiroKit;
import com.sxfq.loansupermarket.backsystem.modular.theTest.dao.CompletedTestDao;
import com.sxfq.loansupermarket.backsystem.modular.theTest.entity.*;
import com.sxfq.loansupermarket.backsystem.modular.theTest.service.ICompletedTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class CompletedTestServiceImpl implements ICompletedTestService {

    @Autowired
    private CompletedTestDao completedTestDao;

    @Override
    public List<CompletedTestInfo> selectPageListByQueryGetMap(Page<CompletedTestInfo> page, SearchTestingInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        params.put("userId", ShiroKit.getUser().getId());
        return completedTestDao.getQueryPage(page, params);
    }

    public List<UserForTestInfo> selectDetails(String theTestId, Integer userId) {
        return completedTestDao.selectDetails(theTestId, userId);
    }
}
